

clear;
lx=262;
ly=388;
lz=7;



% A=zeros(lx,ly,lz);
% 
% for k=1:lz
%     for j=1:ly
%         for i=1:lx
%            %if (((k==1) || (k==lz)) && (abs(i-lx/2)<=10) && (abs(j-ly/2)<=10)) 
%            %if ((k==12) && (abs(i-lx/2)<=9) && (abs(j-ly/2)<=9))
%             %if (sqrt((i-lx*0.3)*(i-lx*0.3)+(j-ly*0.5)*(j-ly*0.5)+(k-lz*0.5)*(k-lz*0.5))<=6)
%            %if ((j==13) && (i>=5) && (i<=lx-5) && (k>=5) && (k<=lz-5))
%           if ((j==1) || (j==ly) || (k==1) || (k==lz)) && (i>=lx/2)
%                 A(i,j,k)=1;
%            end            
%         end
%     end
% end
% 
% fid = fopen('BC.dat','wt');
% 
% for k=1:lz
%     for j=1:ly
%         for i=1:lx
%         fprintf(fid,'%1d\n',A(i,j,k));
%         end
%     end
% end

A=zeros(lx,ly,lz);

for k=1:lz
    for j=1:ly
        for i=1:lx
            if ((j>252) && (j<=388-10))
                A(i,j,k)=1;
            else
                A(i,j,k)=-1;
            end
            
        end
    end
end

fid = fopen('phase4.dat','wt');

for k=1:lz
    for j=1:ly
        for i=1:lx
        fprintf(fid,'%1d\n',A(i,j,k));
        end
    end
    k
end
